#ifndef BALL_H
#define BALL_H

#include <QtGui>
#include "paddle.h"

class Ball : public QObject, public QGraphicsItem
{
     Q_OBJECT
     Q_INTERFACES(QGraphicsItem)
public:
     Ball(int x, int y, int radius, double speed, int direction);
     Ball();
     ~Ball();
     QRectF boundingRect() const;
     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option = 0, QWidget *widget = 0);
     QPainterPath shape() const;
signals:
     void wallCollided(bool isLeftWall);
     void leftPaddleCollided(int score);
     void collided();
protected:
     void advance(int step);
private:
     int radius, speed, direction;
     QGraphicsItem *lastItemCollided;
     qreal xveloc, yveloc;

 };

#endif // BALL_H
